package com.chenfeng.ego.portal.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.chenfeng.ego.commons.pojo.SearchResult;
import com.chenfeng.ego.commons.util.HttpClientUtil;
import com.chenfeng.ego.commons.util.JsonUtils;
import com.chenfeng.ego.portal.service.TbItemService;
@Service
public class TbItemServiceImpl implements TbItemService
{

	@Value("${solrUrl}")
	private String solrUrl;
	@Override
	public SearchResult search(String q, int page, int rows)
	{
		System.out.println(q+":"+solrUrl+":"+"page"+page+"rows"+rows);
		Map<String,String> map = new HashMap<>();
		map.put("q",q);
		map.put("page", page+"");
		map.put("rows", rows+"");
		String result = HttpClientUtil.doPost(solrUrl,map);
		return JsonUtils.jsonToPojo(result, SearchResult.class);
	} 

}
